package com.bdqn.vueboot.service.impl;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service(value = "userServiceImp")
public class UserServiceImp  {
//
//    @Resource
//    UserMapper userRepository;
//implements UserService
//    @Override
//    public User findByUserNameBiz(String uname) {
//        return userRepository.findUserByUsrName(uname);
//    }
//
//    @Override
//    public Page<User> findPageByMap(Map param, Pageable pageable) {
////        return userRepository.findAll(new Specification<User>() {
////            @Override
////            public Predicate toPredicate(Root<User> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
////                List<Predicate> predicates = new ArrayList<>();
////                if (param.get("usrName") != null && !param.get("usrName").equals("")) {
////                    predicates.add(criteriaBuilder.like(root.get("usrName"), "%" + param.get("usrName") + "%"));
////                }
////                return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
////            }
////        }, pageable);
//    }
//
//    @Override
//    public void saveUser(User user) throws Exception {
//        userRepository.save(user);
//    }
//
//    public void deleteByUserId(Long id) throws Exception {
//        userRepository.deleteById(id);
//    }
//
//    public User findByUserIdBiz(Long id) throws Exception {
//        User user = null;
//        if (userRepository.findById(id).isPresent()) {
//            user = userRepository.findById(id).get();
//        }
//        return user;
//    }
//

}
